#include "StdAfx.h"
#include "GStatic.h"

GStatic::GStatic(void)
{
}

GStatic::~GStatic(void)
{
}
void GStatic::LoadResAttritute(map<tstring, tstring>& mapAtt)
{
	map<tstring, tstring>::iterator iter;
	iter = mapAtt.find(_T("bkbmp"));
	if (iter == mapAtt.end()) assert(0);
	m_texture = GImageLoad::LoadTextureFromFile(iter->second.c_str());

	GWnd::LoadResAttritute(mapAtt);
}
void GStatic::HandleMessage(int hWnd,UINT uMsg, int wParam, int lParam)
{

}
void GStatic::Draw()
{
	GRECT rc(m_nLeft, m_nBotton, m_nRight, m_nTop);
	rc.Offset(m_nParentLeft, m_nParentBotton);
	glBindTexture(GL_TEXTURE_2D, m_texture);

	glBegin(GL_QUADS);
	glTexCoord2f( 0, 0);glVertex2f(rc.left, rc.botton);  
	glTexCoord2f( 1, 0);glVertex2f(rc.right, rc.botton);
	glTexCoord2f( 1, 1);glVertex2f(rc.right, rc.top);
	glTexCoord2f( 0, 1);glVertex2f(rc.left, rc.top);	
	glEnd();

	m_font.DrawText(m_strText.c_str(), GRGB(255, 0, 0), rc, GFont::LEFT, GFont::TOP);
}